// page/chooseFiles/chooseFiles.js 
Page({

  /** 
   * 页面的初始数据 
   */
  data: {
    selectCount: 0,
    selectFiles: [],
    loading: false,
    myFiles: [
      { id: 1, name: "文件1", imageType: "image-word", type: "doc", size: "1mb" },
      { id: 2, name: "文件2", imageType: "image-pdf", type: "pdf", size: "2mb" },
      { id: 3, name: "文件3", imageType: "image-photo", type: "png", size: "3mb" },
      { id: 4, name: "文件4", imageType: "image-word", type: "doc", size: "4mb" },
      { id: 5, name: "文件5", imageType: "image-play", type: "mp4", size: "5mb" },
      { id: 6, name: "文件6", imageType: "image-play", type: "mkv", size: "6mb" },
      { id: 1, name: "文件1", imageType: "image-word", type: "doc", size: "1mb" },
      { id: 2, name: "文件2", imageType: "image-pdf", type: "pdf", size: "2mb" },
      { id: 3, name: "文件3", imageType: "image-photo", type: "png", size: "3mb" },
      { id: 4, name: "文件4", imageType: "image-word", type: "doc", size: "4mb" },
      { id: 5, name: "文件5", imageType: "image-play", type: "mp4", size: "5mb" },
      { id: 6, name: "文件6", imageType: "image-play", type: "mkv", size: "6mb" }
    ]
  },
  checkboxChange: function (e) {
    this.setData({
      selectCount: e.detail.value.length,
      selectFiles: e.detail.value
    })
    console.log(this.data.selectFiles)
  },
  sendFiles: function () {
    var that = this
    if (this.data.selectCount == 0) {
      wx.showToast({
        title: '请选择要发送的文件',
        icon: 'none'
      })
    } else {
      this.setData({
        loading: true
      })
      setTimeout(function () {
        wx.showToast({
          title: '发送成功',
        })
        that.setData({
          loading: false
        })
      }, 2000)
    }

  },
  /** 
   * 生命周期函数--监听页面加载 
   */
  onLoad: function (options) {

  },

  /** 
   * 生命周期函数--监听页面初次渲染完成 
   */
  onReady: function () {

  },

  /** 
   * 生命周期函数--监听页面显示 
   */
  onShow: function () {

  },

  /** 
   * 生命周期函数--监听页面隐藏 
   */
  onHide: function () {

  },

  /** 
   * 生命周期函数--监听页面卸载 
   */
  onUnload: function () {

  },

  /** 
   * 页面相关事件处理函数--监听用户下拉动作 
   */
  onPullDownRefresh: function () {

  },

  /** 
   * 页面上拉触底事件的处理函数 
   */
  onReachBottom: function () {

  },

  /** 
   * 用户点击右上角分享 
   */
  onShareAppMessage: function () {

  }
})